<?php

use Illuminate\Http\Request;
use \Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::post('user/img','Api\UploadController@upload_img');

Route::middleware('cors')->group(function () {
    Route::namespace('Api')->group(function () {
        //用户登录
        Route::post('user/login', 'AppController@login');

        Route::middleware('jwtAuth')->group(function () {
            //验证码发送
            Route::post('user/check/code', 'AppController@loginSendCode');
            //验证手机验证码
            Route::post('user/check/phone', 'AppController@checkCode');
            //上传头像图片
            Route::post('user/upload', 'UploadController@picture');
            //任务列表
            Route::get('user/task','TaskController@taskList');





            //用户信息修改
            Route::get('user/info/user', 'AppUserController@userInfo');
            Route::post('user/info/user', 'AppUserController@userInfo');
            //用户工作息息
            Route::get('user/info/worker', 'AppUserController@workerInfo');
            Route::post('user/info/worker', 'AppUserController@workerInfo');
            //用户车辆信息
            Route::get('user/info/car', 'AppUserController@carInfo');
            Route::post('user/info/car', 'AppUserController@carInfo');
            //用户房产信息
            Route::get('user/info/house', 'AppUserController@houseInfo');
            Route::post('user/info/house', 'AppUserController@houseInfo');
            //用户学校信息
            Route::get('user/info/school', 'AppUserController@schoolInfo');
            Route::post('user/info/school', 'AppUserController@schoolInfo');
            //核价
            Route::post('user/order/calculate', 'OrderController@calculate');
            //创建订单
            Route::post('user/order/create', 'OrderController@create');
            //订单列表
            Route::post('user/order/list', 'OrderController@list');
            //订单详情
            Route::post('user/order/detail', 'OrderController@detail');
            //订单状态查询(轮询用)
            Route::post('user/order/status', 'OrderController@status');

        });
    });

});

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});
